home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / Timer.h < prev    next >
Text File  |  1995-07-06  |  3KB  |  140 lines

  1. /*
  2.      File:        Timer.h
  3.  
  4.      Contains:    Time Manager interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __TIMER__
  21. #define __TIMER__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __OSUTILS__
  30. #include <OSUtils.h>
  31. #endif
  32. /*    #include <MixedMode.h>                                        */
  33. /*    #include <Memory.h>                                            */
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=mac68k
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT_SUPPORTED
  44. #pragma import on
  45. #endif
  46.  
  47.  
  48. enum {
  49. /* high bit of qType is set if task is active */
  50.     kTMTaskActive                = (1L << 15)
  51. };
  52.  
  53. typedef struct TMTask TMTask, *TMTaskPtr;
  54.  
  55. /*
  56.         TimerProcPtr uses register based parameters on the 68k and cannot
  57.         be written in or called from a high-level language without the help of
  58.         mixed mode or assembly glue.
  59.  
  60.             typedef pascal void (*TimerProcPtr)(TMTaskPtr tmTaskPtr);
  61.  
  62.         In:
  63.          => tmTaskPtr       A1.L
  64. */
  65.  
  66. #if GENERATINGCFM
  67. typedef UniversalProcPtr TimerUPP;
  68. #else
  69. typedef Register68kProcPtr TimerUPP;
  70. #endif
  71.  
  72. struct TMTask {
  73.     QElemPtr                        qLink;
  74.     short                            qType;
  75.     TimerUPP                        tmAddr;
  76.     long                            tmCount;
  77.     long                            tmWakeUp;
  78.     long                            tmReserved;
  79. };
  80.  
  81. #if !GENERATINGCFM
  82. #pragma parameter InsTime(__A0)
  83. #endif
  84. extern pascal void InsTime(QElemPtr tmTaskPtr)
  85.  ONEWORDINLINE(0xA058);
  86.  
  87. #if !GENERATINGCFM
  88. #pragma parameter InsXTime(__A0)
  89. #endif
  90. extern pascal void InsXTime(QElemPtr tmTaskPtr)
  91.  ONEWORDINLINE(0xA458);
  92.  
  93. #if !GENERATINGCFM
  94. #pragma parameter PrimeTime(__A0, __D0)
  95. #endif
  96. extern pascal void PrimeTime(QElemPtr tmTaskPtr, long count)
  97.  ONEWORDINLINE(0xA05A);
  98.  
  99. #if !GENERATINGCFM
  100. #pragma parameter RmvTime(__A0)
  101. #endif
  102. extern pascal void RmvTime(QElemPtr tmTaskPtr)
  103.  ONEWORDINLINE(0xA059);
  104. extern pascal void Microseconds(UnsignedWide *microTickCount)
  105.  FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  106. enum {
  107.     uppTimerProcInfo = kRegisterBased
  108.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA1, SIZE_CODE(sizeof(TMTaskPtr)))
  109. };
  110.  
  111. #if GENERATINGCFM
  112. #define NewTimerProc(userRoutine)        \
  113.         (TimerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture())
  114. #else
  115. #define NewTimerProc(userRoutine)        \
  116.         ((TimerUPP) (userRoutine))
  117. #endif
  118.  
  119. #if GENERATINGCFM
  120. #define CallTimerProc(userRoutine, tmTaskPtr)        \
  121.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppTimerProcInfo, (tmTaskPtr))
  122. #else
  123. /* (*TimerProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  124. #endif
  125.  
  126.  
  127. #if PRAGMA_IMPORT_SUPPORTED
  128. #pragma import off
  129. #endif
  130.  
  131. #if PRAGMA_ALIGN_SUPPORTED
  132. #pragma options align=reset
  133. #endif
  134.  
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138.  
  139. #endif /* __TIMER__ */
  140.